<% layout('/layouts/default.html', {title: '意见反馈管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('意见反馈管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${ptYijian}" action="${ctx}/pt/ptYijian/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('内容')}：</label>
					<div class="control-inline">
						<#form:input path="content" maxlength="255" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('联系方式')}：</label>
					<div class="control-inline">
						<#form:input path="lianxifangshi" maxlength="255" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('图片')}：</label>
					<div class="control-inline">
						<#form:input path="pics" maxlength="1000" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('时间')}：</label>
					<div class="control-inline">
						<#form:input path="createTime" readonly="true" maxlength="20" class="form-control laydate width-datetime"
							dataFormat="datetime" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('类型')}：</label>
					<div class="control-inline width-120">
						<#form:select path="type" dictType="yijian_leixing" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm isQuick">${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("手机号")}', name:'icUser.mobile', index:'a.user_id', width:150, align:"left", frozen:true},
		{header:'${text("内容")}', name:'content',classes:'huanhang', index:'a.content', width:150, align:"left"},
		{header:'${text("联系方式")}', name:'lianxifangshi', index:'a.lianxifangshi', width:150, align:"left"},
		{header:'${text("图片")}', name:'pics', index:'a.pics', width:150, align:"left", formatter: function(val, obj, row, act){
			var arr = JSON.parse(val);
			var html = "";
			for (let i = 0; i < arr.length; i++) {
				let arrElement = arr[i];
				html+='<img src="'+arrElement+'" width="50" height="50" onclick="tanPic(\''+arrElement+'\')" style="margin-left: 5px"/>';
			}
			return html;
		}},
		{header:'${text("时间")}', name:'createTime', index:'a.create_time', width:150, align:"center"},
		{header:'${text("类型")}', name:'type', index:'a.type', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('yijian_leixing')}, val, '${text("未知")}', true);
		}},
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});

function tanPic(url) {
	js.layer.photos({
		shade:0.3,
		photos: {
			"title": "抓拍图片", //相册标题
			"id": 123, //相册id
			"start": 0, //初始显示的图片序号，默认0
			"data": [   //相册包含的图片，数组格式
				{
					"src": url, //原图地址
					"thumb": url //缩略图地址
				}
			]
		},
		tab: function(pic, layero){
			console.log(pic) //当前图片的一些信息
		}
	});
}

</script>
<style>
	.huanhang{
		white-space:normal !important;
		word-break:break-all !important;
		overflow:hidden !important;
	}
</style>